package com.winway.boot.security.imp;

import com.winway.boot.security.PermissionService;
import com.winway.boot.service.SysMenuService;
import com.winway.boot.service.SysRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

/**
 * @description:
 * @author: levy
 * @date: 2025-9-12 17:05
 */
@Service("permissionService")
public class PermissionServiceImp implements PermissionService {

    @Autowired
    private SysRoleService sysRoleService;

    @Autowired
    private SysMenuService sysMenuService;

    @Override
    public List<String> getPermissions(Long userId) {
        return new ArrayList<>(sysMenuService.getMenusByUserId(userId));
    }

    @Override
    public List<String> getRoles(Long userId) {
        return new ArrayList<>(sysRoleService.getRolesByUserId(userId));
    }
}
